var gulp = require("gulp"),
    mcss = require("gulp_mcss"),
    browserSync = require("browser-sync").create(),
    gulpSequence = require("gulp-sequence"),
    minifyCss = require("gulp-clean-css"),
    minifyHtml = require("gulp-minify-html"),
    concat = require("gulp-concat"),
    uglify = require("gulp-uglify"),
    rimraf = require("gulp-rimraf");
var webpack = require("./webpack.config.js");
// var path={
//     styles: [
//         "src/**/*.mcss"
//     ],
//     scripts: [
//         "src/**/*.js"
//     ],
//     htmls: [
//         "src/**/*.html"
//     ],
//     statics: [
//         "src/res/{fonts,images}/*"
//     ],
//     libs: [
//         "src/lib/director.min.js",
//         "src/lib/react.js",
//         "src/lib/react-dom.js",
//         "src/lib/browser.min.js"
//     ]
// };

// gulp.task("style", function(){
//     return gulp.src(path.styles)
//            .pipe(mcss())
//            .pipe(minifyCss())
//            .pipe(concat("main.css"))
//            .pipe(gulp.dest("dist/css"));
// });
// gulp.task("script", function(){
//     return gulp.src(path.scripts)
//            .pipe(uglify())
//            .pipe(gulp.dest("dist"));
// });
// gulp.task("html", function(){
//     return gulp.src(path.htmls)
//            .pipe(minifyHtml())
//            .pipe(gulp.dest("dist"));
// });
// gulp.task("static", function(){
//     return gulp.src(path.statics)
//            .pipe(gulp.dest("dist"));
// });
// gulp.task("lib", function(){
//     return gulp.src(path.libs)
//             .pipe(gulp.dest("dist/common/lib")); 
// });
// gulp.task("clean", function(){
//     return gulp.src("dist/*",{read:false})
//            .pipe(rimraf({force: true}));
// });
// gulp.task('default', gulpSequence("clean",['static', 'style', 'script', 'html', 'lib']));

gulp.task("watch", function(){
     browserSync.init({
        // server: {
        //     baseDir: "dist/",
        // },
        proxy: "localhost:3000",
        // browser: "google chrome",
        notify: false,
        open: true
    });

    // gulp.watch(path.htmls, ["html"]);
    // gulp.watch(path.scripts, ["script"]);
    // gulp.watch(path.styles, ["style"]);
    // gulp.watch(path.statics, ["static"]);

    // gulp.watch(["dist/*", "dist/**/*"], browserSync.reload);
});
gulp.task("webpack", function(){
    webpack();
})
gulp.task("build", ["webpack"]);